#include<stdio.h>
#include<stdlib.h>
struct ListNode {
	int val;
	struct ListNode* next;
};
struct ListNode* ReverseList(struct ListNode* head) {
    // write code here
    struct ListNode* newhead = NULL;
    while (head) {
        struct ListNode* newnode = (struct ListNode*)malloc(sizeof(struct ListNode));
        newnode->next = newhead;
        newnode->val = head->val;
        newhead = newnode;
        head = head->next;
    }
    return newhead;
}
int main()
{
    return 0;
}